package com.igeek.oa.controller;

import cn.hutool.core.util.ObjectUtil;
import com.igeek.oa.entity.Officesupplies;
import com.igeek.oa.result.Result;
import com.igeek.oa.service.IOfficesuppliesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/officesupplies")
@Api("办公用品库存查询")
public class OfficesuppliesController {
    @Autowired
    private IOfficesuppliesService iOfficesuppliesService;
    @ApiOperation("获取所有办公用品")
    @GetMapping("/getOfficesupplies")
    public Result getOfficesupplies(){
        try {
            List<Officesupplies> officesuppliesList = iOfficesuppliesService.getOfficesupplies();
            if(ObjectUtil.isNotEmpty(officesuppliesList)){
               return new Result(true,"查询成功",officesuppliesList);
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return new Result(true,"查询失败",null);
    }
}
